package yz.cp.back.s.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import yz.cp.back.s.entity.SysRoleDepartment;
import yz.cp.back.s.mapper.SysRoleDepartmentMapper;
import yz.cp.back.s.service.ISysRoleDepartmentService;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-04-03
 */
@Service
public class SysRoleDepartmentServiceImpl extends ServiceImpl<SysRoleDepartmentMapper, SysRoleDepartment> implements ISysRoleDepartmentService {

    @Override
    public List<SysRoleDepartment> findByRoleId(String roleId) {
       return list(new QueryWrapper<SysRoleDepartment>().lambda().eq(SysRoleDepartment::getRoleId,roleId));
    }

    @Override
    public void deleteByRoleId(String roleId) {
        remove(new QueryWrapper<SysRoleDepartment>().lambda().eq(SysRoleDepartment::getRoleId,roleId));
    }

    @Override
    public void deleteByDepartmentId(String departmentId) {

        remove(new QueryWrapper<SysRoleDepartment>().lambda().eq(SysRoleDepartment::getDepartmentId,departmentId));

    }
}
